function SatellitetrackingAssistant() {
	/** this is the creator function for your scene assistant object. It will be passed all the 
	*   additional parameters (after the scene name) that were passed to pushScene. The reference
	*   to the scene controller (this.controller) has not be established yet, so any initialization
	*   that needs the scene controller should be done in the setup function below.
	*/
}

/** this function is for setup tasks that have to happen when the scene is first created 
*/
SatellitetrackingAssistant.prototype.setup = function() {
	/** use Mojo.View.render to render view templates and add them to the scene, if needed.
	 */
	
	/** setup widgets here-
	 * Instantiates UI widgets for login scene. Each widget requires attributes and a model.
	 * These are passed to the widget in a JSON object.
	 */
	this.controller.setupWidget('location-activity-spinner', 
	 	this.locationSpinnerAttributes = {spinnerSize: Mojo.Widget.spinnerLarge}, {});
	this.controller.get('overlay-scrim').hide();
	

	this.controller.setupWidget("satellitewindow",
         this.satellitewindowAttributes = {
             url:    '',
             virtualpagewidth: 820,
             virtualpageheight: 880,
			 useMouseEvents: false,
			 showClickedLink: false,
			 minFontSize: 60,
			 interrogateClicks: true,
             },
         this.satellitewindowModel = {
             }
	);
	
	/* add event handlers to listen to events from widgets */
	this.handleLoaded = this.handleLoaded.bindAsEventListener(this);
	Mojo.Event.listen(this.controller.get('satellitewindow'),Mojo.Event.webViewLoadStopped, this.handleLoaded);
}
/**This function waits for user input by means of orientation change, and then
 *activates a busy spinner ultimately waiting for the end findMe call.
 *
 *
 */
SatellitetrackingAssistant.prototype.activate = function(event) {
	/** put in event handlers here that should only be in effect when this scene is active. For
	 * example, key handlers that are observing the document
	 */
	this.controller.setInitialFocusedElement(this.controller.get('satellitewindow'));
	this.controller.get('location-activity-spinner').mojo.start()
	this.findMe();
}

/** remove any event handlers you added in activate and do any other cleanup that should happen before
	  * this scene is popped or another scene is pushed on top
	  */
SatellitetrackingAssistant.prototype.deactivate = function(event) {
	
}
/** this function should do any cleanup needed before the scene is destroyed as
	 *  a result of being popped off the scene stack
	 */
SatellitetrackingAssistant.prototype.cleanup = function(event) {
	
}
/**Stops spinner on screen when loaded.
 */
SatellitetrackingAssistant.prototype.handleLoaded = function(event) {
	this.controller.get('overlay-scrim').hide();
	this.controller.get('location-activity-spinner').mojo.stop();
}

/** This is the callback function for  finding your location.  Once activated it
 *starts a busy spinner on the screen while getting location data.
 *@param data The location data for the current device.
 */
SatellitetrackingAssistant.prototype.locationCallback = function(data) {
	var locationResponse;
	switch (data.errorCode) {
					case 0:
						locationResponse = "Latitude: " + data.latitude + "\n" + "Longitude: " + data.longitude;
						break;
					case 1:
						locationResponse = "GPS Timeout.";
						break;
					case 2:
						locationResponse = "Position Unavailable.";
						break;
					case 5:
						locationResponse = "Location services are turned off.";
						break;					
					default:
						locationResponse = "Location error: " + data.errorCode;
						break;
				}
				this.controller.get('overlay-scrim').show();
				this.controller.get('location-activity-spinner').mojo.start();
				/*
				this.controller.showAlertDialog({
				    title: $L("Current Lat/Long"),
				    message: $L(locationResponse),
					choices:[{label:$L('Ok')}]
				});
				*/
				if (data.errorCode == 0) {
					this.getNearbySatelliteList(data);
				}
				else {
					this.controller.showAlertDialog({
				    	title: $L("GPS Error"),
				    	message: $L('Please try again.'),
						choices:[{label:$L('Ok')}]
					});
					this.controller.stageController.popScene();
				}
}

/**This function displays a busy spinner while querying the palm database for gps
 *location.  Then it calls it's callback function with that data.
 *
 */
SatellitetrackingAssistant.prototype.findMe = function(event) {
	this.controller.get('overlay-scrim').show();
	this.controller.get('location-activity-spinner').mojo.start();
	this.controller.serviceRequest('palm://com.palm.location', {
		method:"getCurrentPosition",
		parameters:{accuracy: 'Medium', maximumAge: 10, responseTime: 1},
		onSuccess: function( data ) 
			{
				this.locationCallback(data);
			}.bind(this),
		onFailure: function( data )
			{
				this.locationCallback(data);
			}.bind(this),
		}
	);
}

/** This function opens a webpage in the current skywindow iframe.
 */
SatellitetrackingAssistant.prototype.getNearbySatelliteList = function(event) {
	this.controller.get('satellitewindow').mojo.openURL('http://www.thebbim.com/pageParser.php?&latitude=' + data.latitude + '&longitude=' + data.longitude);
}